﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace Strategy.Core.TradeStreams
{
    public interface ITradeIndicatorLevel
    {
        int getLevel();
        void Update(Strategy.Core.TradeTypes.QuoteData qd);
        string getID();
    }
    public abstract class ITradeStream<T> : ITradeIndicatorLevel
    {
        protected List<T> values;
        public int Count { get { return values.Count; } }
        public virtual T getByIndexFromEnd(int index)   { return values[values.Count - 1 - index]; }
        public virtual T getByIndexFromStart(int index) { return values[index];}
        public TimeSpan Interval { get; protected set; }
        public abstract void Update(Strategy.Core.TradeTypes.QuoteData qd);
        public abstract int getLevel();
        public abstract string getID();
    }
    public class TradeStreamLevelComparer : Comparer<ITradeIndicatorLevel>
    {

        public override int Compare(ITradeIndicatorLevel x, ITradeIndicatorLevel y)
        {
            return x.getLevel().CompareTo(y.getLevel());
        }
    }
}
